package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppUserCollectionDao;
import com.vf.admin.client.service.AppUserCollectionService;
import com.vf.admin.miaodong.entity.AppUserCollection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppUserCollectionServiceImpl implements AppUserCollectionService {

    @Autowired
    AppUserCollectionDao appUserCollectionDao;

    @Override
    public void saveOrUpdate(AppUserCollection params) {
        appUserCollectionDao.saveOrUpdate(params);
    }

    @Override
    public AppUserCollection findByUserId(Integer userId) {
        return appUserCollectionDao.findByUserId(userId);
    }

    @Override
    public AppUserCollection findByUserIdOrNULL(Integer userId) {
        AppUserCollection collection = appUserCollectionDao.findByUserId(userId);
        if(collection == null) {
            collection= new AppUserCollection();
            collection.setUserid(userId);
            collection.setBankcard("");
            collection.setBankcardname("");
            collection.setAliphonenum("");
            collection.setAliname("");
        }
        return collection;
    }
}
